﻿using System.Collections.Generic;
using NUnit.Framework;
using StringExt;

namespace DictionaryExt.Test {

    [TestFixture]
    public class ToDictionaryExceptionWith2Sep {

        [Test]
        public void Middle2SepAnd1Value() {
            Assert.Throws<PatternException>(Middle2SepAnd1ValueException);
        }
        static void Middle2SepAnd1ValueException() {
            const string s = "a==1";
            IDictionary<string, string> result = s.ToDictionary(StringExt.StringExt.RemoveSurroundingBlanks.No);
            Assert.AreEqual(1, result.Count);

        }

        [Test]
        public void Middle2SepAnd2Value() {
            Assert.Throws<PatternException>(Middle2SepAnd2ValueException);
        }
        static void Middle2SepAnd2ValueException() {
            const string s = "a=1=2";
            IDictionary<string, string> result = s.ToDictionary(StringExt.StringExt.RemoveSurroundingBlanks.No);
            Assert.AreEqual(1, result.Count);

        }
    }
}
